home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
151-175
/
scopedisk174
/
xaread
/
xaread.doc
< prev
next >
Wrap
Text File
|
1995-03-19
|
16KB
|
333 lines
XARead - Batch files to assist Amiga-Bridgeboard File Transfer.
I. Background.
When I got my bridgeboard, I became frustrated early on with the limitations
in transferring files from the Amiga side to the Bridgeboard side, and vice
versa. Most frustrating was the lack of support for wild cards. When
sending something from the IBM side to the Amiga side, it wasn't so bad,
because at least the AWRITE command understood MS-DOS wild cards. But using
AREAD, you had to spell out the entire file name for each file you wanted to
transfer. For example, when I had twenty GIF files I wanted to move to the
IBM side, I would have liked to have a command like this:
AREAD #?.GIF /b or,
AREAD *.GIF /b
Unfortunately, no such facility exists. Nope, you have to enter twenty
AREAD commands, with the full filename on each one. A desire to overcome
this obstacle is what led me to write XAREAD (eXtended AREAD), a short and
deceptively simple set of batch files that allows me to get around the
problem.
II. What is XAREAD?
XAREAD is two batch files - one for the Amiga side and one for the IBM side
- that work together to allow a user to specify AmigaDOS wild cards to
transfer files from the Amiga side to the IBM side. The solution is a
little cheesy, but it does work, and once you've used it for mass transfers,
you'll love it despite its dairy heritage.
Basically, I cheat. The way it works is that XAREAD, an Amiga batch file,
runs on the Amiga side, and uses the wild cards you specify to look up the
files that that spec includes. It invokes the AmigaDOS LIST command to
build an MS-DOS syntax batch file named T:ZZZAREAD.BAT. Then you go to the
MS-DOS side of the BridgeBoard and execute XAREAD.BAT, an MS-DOS batch file.
This batch file AREADs over the ZZZAREAD.BAT file, and then executes it. In
turn, ZZZAREAD.BAT moves over all those files you specified. So in the end,
you run one command on each side. Nice, huh?
III. Requirements.
I really wrote this for my own use and, while I tried to keep it open-ended
enough to work for everyone, there are no guarantees. I'm running with
MS-DOS 3.2, AmigaDOS 1.3, with Janus 2.0 on an A2000 equipped with an A2088
BridgeBoard. I suspect it should work with lower levels of MS-DOS, and I
hope it would be upward compatible to higher levels (in fact, there's a
cleaner way of invoking ZZZAREAD.BAT from XAREAD.BAT in MS-DOS 3.3 - the
CALL command - but the 3.2 way should also continue to work). On the Amiga
side, XAREAD uses the LFORMAT option of LIST, which only became available in
1.3. I don't think Janus level or the type of bridgeboard should be an
issue, as long as the AREAD command works properly.
IV. Syntax.
The general syntax for invoking XAREAD on the Amiga side is:
XAREAD <amigafile-spec> <msdos-directory> [optional flags]
On the IBM side, there are no operands. Just invoke it like this:
XAREAD
Remember, the intelligence of AmigaDOS is doing all the behind the scenes
work, and the IBM XAREAD command is just to consummate the transfer.
The "<amigafile-spec>" can technically be any valid AmigaDOS file
specification, with or without wildcards. However, there's an important
consideration to take into account. First, I'll give the Long Drawn Out
Explanation for those of you who really care, and then for those who just
want the silly thing to work, I'll give a Good Rule Of Thumb to make it
work.
LDOE: Because of the way the Bridgeboard is set up, when an AREAD is issued
on the MS-DOS side, if the AmigaDOS file name is relatively specified (e.g.
"mydir/file1.txt" or just "file1.txt"), the filename will be resolved
against whatever was the current directory at the time the Bridgeboard was
activated (when you clicked on the "PC Color" or "PC Mono" icon). This
directory is the one in which the icons exist. For me (and I think the
standard), that's SYS:PC. So when you do an AREAD for "file1.txt", XAREAD
will look for "SYS:PC/file1.txt". When you AREAD "mydir/file1.txt", it'll
look for "SYS:PC/mydir/file1.txt". This presents no problems as long as
your current directory is SYS:PC when you invoke XAREAD; Amiga and
BridgeBoard are on the same page, as it were. The problem is if you're CDed
to the directory SYS:GIFPics and try the command XAREAD #?.GIF. This will
generate a lot of AREAD commands to get FILE1.GIF, FILE2.GIF, etc. The only
problem is that when the AREADs eventually execute on the MS-DOS side,
they'll be looking for SYS:PC/FILE1.GIF, etc. and the AREADs will fail. The
best way to avoid this problem is to always use an absolute reference for
the Amiga filespec when using XAREAD.
GROT: As long as you include a colon (:) in the Amiga file specification,
the specification will be an absolute one, and XAREAD on the MS-DOS side
will have no trouble finding the files to be received. The colon can be
part of a device name (e.g. DF2:, JH0:, RAM:), a disk volume name (e.g.
GIFPics01:, LotusFiles-17:), or ASSIGNed name (WHAP:, TEMP:, S:). The one
exception is starting with the colon (which would indicate the root
directory of the disk you're currently CDed to). That'll only work if
you're CDed to the same disk device that contained the directory that the PC
session was launched from. By the way, XAREAD cannot check that you
included a colon. I could have written it in ARexx and checked, but I
wanted to make sure anyone could use it, not just ARexx owners.
As far as the IBM destination directory is concerned, you can use whatever
directory specification you want. Just remember that the directory must
already exist. If you specify a directory that doesn't exist, the XAREAD on
the IBM side will fail.
I'm assuming you're more or less familiar with the MS-DOS directory scheme,
but there are some subtleties you ought to be aware of. First, to reference
the current directory, you could normally just leave off any directory
specification on most MS-DOS commands (AREAD included). Unfortunately, if
you leave out the destination directory on XAREAD, it isn't smart enough to
realize that any flags you've specified are flags, and not the name of a
directory on the MS-DOS side, so you MUST specify an MS-DOS destination
directory.
However, the MS-DOS directory CAN be relative. The easiest is to just use
a period (.) to indicate the current directory. Or you can use the
backslash (\) to indicate the root, or a directory relative to the root.
Just to round things out, the double-period (..) can be used to specify the
directory that is the immediate parent of the current MS-DOS directory. I'm
sorry if this all sounds complicated. It's really not. It'll all be clear
when you look at the examples.
The "optional flags" are any flags allowed by the AREAD command. The only
one I ever use is "/b" (binary), to transfer non-text files with no
character translation.
V. Installation.
I'm assuming you've already got the Bridgeboard hardware and software
installed and working. The Janus-supplied AREAD command must be in a
directory that is in your MS-DOS execution path.
Put the file XAREAD in your AmigaDOS S: directory. You can either use
EXECUTE to execute it, or else designate it as an executable script file,
and forget the hassle of typing EXECUTE each time you use it. The examples
in this document file assume you've done this. Just issue the CLI command
PROTECT S:XAREAD +S, and it'll be marked as executable. I'm also assuming
that S: is in your PATH list. For more information on this stuff, see the
description of the WorkBench 1.2 or 1.3 PATH command, the 1.3 PROTECT
command, and the description of scripts in the 1.3 book, pages 1-4 though
1-5.
Put the file XAREAD.BAT in any directory on your MS-DOS system disk
(probably the C: drive) that you have in your PATH. You'll need to transfer
it over with AREAD; this could be the last time you use AREAD directly.
AmigaDOS has a convention of storing temporary files in the T: directory.
XARead follows that convention. If you already have a T: directory, you're
in good shape; otherwise, you'll have to create one. To find out if you
have one, try the AmigaDOS command "DIR T:". If you get a file requestor
asking you to mount volume T:, you don't have one, and must create one prior
to using XAREAD (or the Amiga supplied SPAT or DPAT commands, for that
matter).
To allocate a T: directory, first issue the AmigaDOS command "MAKEDIR
SYS:T". You might get an error message "SYS:T already exists". That's
okay. Next, issue the command "ASSIGN T: SYS:T". You'll be all set. You
probably want to put that ASSIGN command in your startup-sequence so you
have it from now on.
Finally, since XAREAD makes use of the WorkBench 1.3 environmental
variables, you also need an ENV: directory. The most straightforward way to
do this is to just put the following commands in your startup sequence:
MAKEDIR RAM:ENV
ASSIGN ENV: RAM:ENV
VI. Other Notes.
Unlike the more enlightened AmigaDOS, MS-DOS limits its file names to a one
to eight-character filename plus a one to three character file extension.
You really should only transfer files between the two that conform to the
MS-DOS restrictions. If you have a file on the Amiga side that does not
conform to these restrictions, you can't transfer it to the IBM side and
retain the same name. For example, if you had a file named ROUGHDRAFT.TEXT
on DF0:, and wanted to transfer it to the A: drive using AREAD directly
(without XAREAD), you'd probably do something like this:
AREAD DF0:ROUGHDRAFT.TEXT A:RUFDRAFT.TXT
because you know the about the MS-DOS filename limitations. However XAREAD,
not having anywhere near your intelligence, will generate the following
AREAD command for execution:
AREAD DF0:ROUGHDRAFT.TEXT A:ROUGHDRAFT.TEXT
The "A:ROUGHDRAFT.TEXT" is an illegal MS-DOS filename. No big deal; MS-DOS
conventions truncate too-long filenames and extensions, and it will treat it
as if you entered it this way:
AREAD DF0:ROUGHDRAFT.TEXT A:ROUGHDRA.TEX
dropping the "FT" and "T" off the ends of the filename parts. No real
problem here. However, what if you have two files on DF0: that you want
to transfer to A:, with the names TERMPAPER1.TEXT and TERMPAPER2.TEXT? With
straight AREAD, you'd be smart enough to do this:
AREAD DF0:TERMPAPER1.TEXT A:TERMPAP1.TXT
AREAD DF0:TERMPAPER2.TEXT A:TERMPAP2.TXT
No problem. But using XAREAD, you'd probably do this:
XAREAD DF0:TERMPAPER#? A:
Which would generate this:
AREAD DF0:TERMPAPER1.TEXT A:TERMPAPER1.TEXT
AREAD DF0:TERMPAPER2.TEXT A:TERMPAPER2.TEXT
Which would be treated as if the AREAD commands were:
AREAD DF0:TERMPAPER1.TEXT A:TERMPAPE.TEX
AREAD DF0:TERMPAPER2.TEXT A:TERMPAPE.TEX
In other words, the first AREAD would copy over TERMPAPER1.TEXT to the
MS-DOS file TERMPAP.TEX. Then the second AREAD would copy over
TERMPAPER2.TEXT, also to MS-DOS file TERMPAP.TEX, overwriting and destroying
what the first AREAD brought over (without warning, by the way). I don't
know what to tell you about this except to be careful. On the positive
side, the original files on the Amiga side are still intact; you can
retransmit them manually, or rename them to MS-DOS compliant names and reuse
XAREAD.
VII. Examples.
On each of these examples, unless otherwise specified, I'm only showing the
syntax on the Amiga side. The IBM side, you just type XAREAD with no
options (after you did the XAREAD on the Amiga side).
1) Transfer all files from Amiga's DF0: to IBM's A: drive, translating Amiga
character set to IBM-compatible (i.e., the files are assumed to be
non-binary text files). Note that if DF0: is full, you'll run out of space
on the A: drive, since an Amiga 3.5 inch disk holds 880K, while the IBM 5.25
inch disks (at least the ones that work with my setup) only hold 360K:
XAREAD DF0:#? A:
2) Transfer all GIF files on the RAM: disk to the directory named GIF on the
IBM side, suppressing translation (GIFs are binary files):
XAREAD RAM:#?.GIF \GIF /b
3) Another way of doing the same thing:
XAREAD RAM:#?.GIF . /b
then, on the MSDOS side:
CD \GIF
XAREAD
In ex. 2, we specify that the destination directory is \GIF. In ex. 3, we
specify that the destination directory is the current MS-DOS directory (.),
and make the \GIF directory the current directory before commencing the
transfer.
4) Copy all the .COM and .EXE files (binary) from the TEMP: assigned name to
the MS-DOS directory named \TEMP\COMMANDS:
XAREAD TEMP:#?.((COM)|(EXE)) \TEMP\COMMANDS /b
5) Copy all the .TXT files that begin with a "J" from the TEMP: directory to
the "TEXT" directory on the A: disk, translating them from Amiga ASCII to
IBM ASCII:
XAREAD TEMP:B#?.TXT A:\TEXT
6) Copy all the files from an IBM 720K 3.25 disk in DF2: to the MS-DOS root
directory, using the Consultron product CrossDos (you have to have at least
the CrossDos demo program for this to work), as binary files:
XAREAD DI2:#? \ /b
Incidentally, if you ever have a need to read IBM 720K 3.25 inch diskettes,
get the CrossDos demo. It's worth the download time wherever you get it.
The demo allows read-only access to IBM disks in the Amiga drives
(low-density only, because the drives themselves can't handle the 1.44 meg
format). If you need read-write access, go buy the real thing.
VIII. Acknowledgements.
I got the idea for this from the way IBM does their multiple file transfers
on their IBMLink service. They, too, create a batch file that can be
downloaded to the PC, and which contains all the commands to download the
other files. It doesn't work, but at least they were headed in the right
direction.
If you look at the XAREAD AmigaDOS batch file, you'll see some similarities
to the SPAT batch file that came with WorkBench 1.3. That also helped.
IX. Warranty.
Are you kidding? Use at your own risk.
X. Status, contacts, etc.
These files are Public Domain. You can distribute them anywhere you like,
but I ask that you keep the files in the .LZH file together and unaltered.
If you have any questions, comments, or suggestions I'd love to hear from
you. I'd also like to hear from you if you make any improvements. Like I
noted above, there're a lot of areas that XAREAD is a little dumb, allowing
you to do things wrong, and there are probably opportunities for
improvement. If you make any, please let me know.
Again, this is Public Domain, not ShareWare, but if you like this and use it
a lot, and want to express your appreciation in a financial way, please make
a contribution to the American Cancer Society, and drop me a line and let me
know you did. That would make my day.
Terry Carroll
CAAUG BBS ((216)-642-3344) User ID Terry Carroll
PC-Ohio ((216)-381-3320) User ID Terry Carroll
CompuServe User ID 71550,133
23 November 1990